<template>
    <div class="carry">
        <v-navbar></v-navbar>
        <div class="carry-wrapper" ref="carry">
            <div>
                <head-icon :className="className"></head-icon>
                <v-assets :data="data" :type="type"/>
            </div>
        </div>
    </div>
</template>

<script>
import navbar from '@c/navbar/navbar'
import headIcon from '@c/headIcon/headIcon'
import { mapState, mapMutations } from 'vuex'
import { vpost, sonpost, fpost, gpost, vlink } from '@api/axios'
import { tokenPost, jtpost, gtpost, tokenLink, jtget } from '@api/axiosByToken'
import assets from '@c/assets/assets'
export default {
	name: 'Balance',
	data() {
		return {
			routine: 5,
			fact: 10,
			className: 'carry',
			type: 0,
			data: {}
		}
	},
	components: {
		'v-navbar': navbar,
		'head-icon': headIcon,
		'v-assets': assets,
	},
	computed: {
		...mapState(['wtitle', 'rback', 'signed']),
	},
	methods: {
		...mapMutations(['WTITLE', 'RBACK', 'USERSINGED']),
		// 获得后台数据
		_getBalanceData() {
			let userInfo = {
				userId: window.localStorage.userId
			}
			this.$store.state.loadding = true
			tokenPost(tokenLink.balance, userInfo).then(re => {
				this.$store.state.loadding = false
				if (re.status === 0) {
					this.data = re.data
				} else {
					this.$Message.success(re.msg)
				}
			})
		}
	},
	created() {
		this.WTITLE('我的余额')
		this.RBACK(true)
		this._getBalanceData()
	},
}
</script>
